Fix Git ref refresh resource storms - #4727
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Needs human review This PR introduces substantial new caching infrastructure for Git ref operations, including multi-layer caches with TTL management, coalescing of concurrent requests, environment-wide invalidation on mutations, and exponential backoff for failures. The complexity of the new state management and fundamental changes to ref fetching behavior warrant human review. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
501a738 to
f2449b5
Compare
6caf609 to
45ac080
Compare
2a9d07e to
dfc1459
Compare
dfc1459 to
561c035
Compare
561c035 to
4f3a660
Compare
4f3a660 to
ff4df7f
Compare
ff4df7f to
4ba5ea3
Compare
4ba5ea3 to
25c0c7a
Compare
25c0c7a to
7fa76c8
Compare
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
6deb060 to
2c4c29c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Bugbot Autofix is ON, but a cloud agent failed to start.
Reviewed by Cursor Bugbot for commit 2c4c29c. Configure here.
## What's Changed * Add OTA update checks to mobile settings by @juliusmarminge in pingdotgg/t3code#4686 * fix(mobile): threads load snapped to bottom on iOS by @t3dotgg in pingdotgg/t3code#4689 * feat: default sidebar v2 on for nightly and dev builds by @t3dotgg in pingdotgg/t3code#4491 * fix(web): 33 web UI fixes by @maxktz in pingdotgg/t3code#4700 * Make mobile Thread List v2 the default by @juliusmarminge in pingdotgg/t3code#4717 * Fix mobile showcase workflow without Clerk by @juliusmarminge in pingdotgg/t3code#4718 * Fix relay credential lookup for unlinked environments by @juliusmarminge in pingdotgg/t3code#4692 * Settle merged PR threads immediately by @t3dotgg in pingdotgg/t3code#4704 * feat(web): add maria's sidebar header artwork toggle by @maxktz in pingdotgg/t3code#4652 * feat(web): add appearance settings category by @maxktz in pingdotgg/t3code#4715 * fix(desktop): allow updater-controlled relaunch by @0x4bs3nt in pingdotgg/t3code#4721 * fix(web): prevent diff panel scroll jumping by @0x4bs3nt in pingdotgg/t3code#4724 * Link inline code file paths in chat markdown by @juliusmarminge in pingdotgg/t3code#4726 * Fix Android showcase capture and rebuild v2 queued rows by @juliusmarminge in pingdotgg/t3code#4730 * perf(server): negotiate permessage-deflate on the websocket by @t3dotgg in pingdotgg/t3code#4705 * docs: overhaul agent guidance by @t3dotgg in pingdotgg/t3code#4782 * Prevent sidebar row labels from truncating by @juliusmarminge in pingdotgg/t3code#4789 * perf(server): gzip large thread snapshots by @t3dotgg in pingdotgg/t3code#4788 * fix(web): stashed prompts now survive switching providers by @t3dotgg in pingdotgg/t3code#4787 * Fix Git ref refresh resource storms by @juliusmarminge in pingdotgg/t3code#4727 * perf(server): trim stale context-window rows and drop dead replay RPC by @t3dotgg in pingdotgg/t3code#4791 * fix(web): defer command palette filesystem navigation by @juliusmarminge in pingdotgg/t3code#2109 * fix(release): skip scripts during Vercel installs by @t3dotgg in pingdotgg/t3code#4796 * refactor(client): share filesystem browse navigation by @juliusmarminge in pingdotgg/t3code#4797 * fix(mobile): defer filesystem navigation by @juliusmarminge in pingdotgg/t3code#4799 * refactor(server): use native HTTP compression streams by @juliusmarminge in pingdotgg/t3code#4798 * Remove Connect waitlist and add GA announcement tooling by @juliusmarminge in pingdotgg/t3code#4691 **Full Changelog**: pingdotgg/t3code@v0.0.29...v0.0.30 ## What's Changed * Add OTA update checks to mobile settings by @juliusmarminge in pingdotgg/t3code#4686 * fix(mobile): threads load snapped to bottom on iOS by @t3dotgg in pingdotgg/t3code#4689 * feat: default sidebar v2 on for nightly and dev builds by @t3dotgg in pingdotgg/t3code#4491 * fix(web): 33 web UI fixes by @maxktz in pingdotgg/t3code#4700 * Make mobile Thread List v2 the default by @juliusmarminge in pingdotgg/t3code#4717 * Fix mobile showcase workflow without Clerk by @juliusmarminge in pingdotgg/t3code#4718 * Fix relay credential lookup for unlinked environments by @juliusmarminge in pingdotgg/t3code#4692 * Settle merged PR threads immediately by @t3dotgg in pingdotgg/t3code#4704 * feat(web): add maria's sidebar header artwork toggle by @maxktz in pingdotgg/t3code#4652 * feat(web): add appearance settings category by @maxktz in pingdotgg/t3code#4715 * fix(desktop): allow updater-controlled relaunch by @0x4bs3nt in pingdotgg/t3code#4721 * fix(web): prevent diff panel scroll jumping by @0x4bs3nt in pingdotgg/t3code#4724 * Link inline code file paths in chat markdown by @juliusmarminge in pingdotgg/t3code#4726 * Fix Android showcase capture and rebuild v2 queued rows by @juliusmarminge in pingdotgg/t3code#4730 * perf(server): negotiate permessage-deflate on the websocket by @t3dotgg in pingdotgg/t3code#4705 * docs: overhaul agent guidance by @t3dotgg in pingdotgg/t3code#4782 * Prevent sidebar row labels from truncating by @juliusmarminge in pingdotgg/t3code#4789 * perf(server): gzip large thread snapshots by @t3dotgg in pingdotgg/t3code#4788 * fix(web): stashed prompts now survive switching providers by @t3dotgg in pingdotgg/t3code#4787 * Fix Git ref refresh resource storms by @juliusmarminge in pingdotgg/t3code#4727 * perf(server): trim stale context-window rows and drop dead replay RPC by @t3dotgg in pingdotgg/t3code#4791 * fix(web): defer command palette filesystem navigation by @juliusmarminge in pingdotgg/t3code#2109 * fix(release): skip scripts during Vercel installs by @t3dotgg in pingdotgg/t3code#4796 * refactor(client): share filesystem browse navigation by @juliusmarminge in pingdotgg/t3code#4797 * fix(mobile): defer filesystem navigation by @juliusmarminge in pingdotgg/t3code#4799 * refactor(server): use native HTTP compression streams by @juliusmarminge in pingdotgg/t3code#4798 * Remove Connect waitlist and add GA announcement tooling by @juliusmarminge in pingdotgg/t3code#4691 **Full Changelog**: pingdotgg/t3code@v0.0.29...v0.0.30 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.30
…pstream's coalesced ref snapshots, PR pingdotgg#4727)
…m conflict (#165) Blind theirs on fork/tim dropped main's vcs resource-storm fix while leaving main's vcs tests, so integration Test failed. Restore main's VCS client/server files and prefer ours for those paths on future Tim rebases. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
fix(stack): rejoin fork VCS/UI APIs after main pingdotgg#4727 restore
…orktree cleanup Join upstream Git ref-refresh resource-storm fixes with fork contracts (failureKind, commit signing, worktree cleanup RPCs, reuse-base-branch UI) instead of leaving tip-only fix(stack) recovery commits after Tim whole-file conflict policies.
…nd; green tip Bring Tim layer tip to typecheck green by joining main ref-refresh VCS client state with fork failureKind/worktree-cleanup contracts, restoring filterBrowseEntries/reuse-base-branch surfaces Tim dropped, and fixing ChatView/Board call-site type errors left by incomplete Tim joins.
…orktree cleanup Join upstream Git ref-refresh resource-storm fixes with fork contracts (failureKind, commit signing, worktree cleanup RPCs, reuse-base-branch UI) instead of leaving tip-only fix(stack) recovery commits after Tim whole-file conflict policies.
…nd; green tip Bring Tim layer tip to typecheck green by joining main ref-refresh VCS client state with fork failureKind/worktree-cleanup contracts, restoring filterBrowseEntries/reuse-base-branch surfaces Tim dropped, and fixing ChatView/Board call-site type errors left by incomplete Tim joins. (cherry picked from commit 0e24917)
…orktree cleanup Join upstream Git ref-refresh resource-storm fixes with fork contracts (failureKind, commit signing, worktree cleanup RPCs, reuse-base-branch UI) instead of leaving tip-only fix(stack) recovery commits after Tim whole-file conflict policies.
…nd; green tip Bring Tim layer tip to typecheck green by joining main ref-refresh VCS client state with fork failureKind/worktree-cleanup contracts, restoring filterBrowseEntries/reuse-base-branch surfaces Tim dropped, and fixing ChatView/Board call-site type errors left by incomplete Tim joins. (cherry picked from commit 0e24917)
Brings in 20 upstream commits including native resource diagnostics (pingdotgg#2679), event-driven Git ref invalidation (pingdotgg#4727), 300MB installer size reduction (pingdotgg#4824), thread-shell preservation while detail loads (pingdotgg#4830), HTTP compression, and the v0.0.30 release prep. Merge resolutions of note: - vcs.ts / ProcessDiagnostics / EventNdjsonLogger: upstream superseded our polling-interval, WMI, and log-batching fixes with better implementations - build-desktop-artifact: kept fork artifact naming + bundled Codex plugin extraResource on top of upstream's size optimizations - ChatView/ChatComposer: both feature sets kept (send-morph/reveal/hydration + thread-shell loading, sendDisabledReason, ThreadSyncStatusPill) - RpcAuthorization: added fork-only shell.revealPath scope - AGENTS.md: kept fork operational rules, took upstream's product sections - ProjectionPipeline: expiry timestamps via DateTime.nowUnsafe (wall clock) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Conflict resolutions and fork fixups: - apps/web/src/localApi.ts: upstream pingdotgg#2679 moved `server.*` and `shell.openInEditor` off the `LocalApi` host facade (localApi.test.ts now asserts they are absent). Took upstream's version and dropped the fork's `server` shim, repointing its one caller (SettingsPanels.refreshProviderInstance) at `callPrimaryRpc` directly. - apps/server/src/auth/RpcAuthorization.ts: upstream's new scope map is exhaustive over WsRpcGroup, so declare scopes for the fork's 15 PR-workspace git.* RPCs (reads -> orchestration:read, mutations -> orchestration:operate). - packages/client-runtime/src/state/shell-sync.test.ts: add the removeVcsRefs/clearVcsRefs stubs that two fork-added cache mocks were missing (pre-existing breakage from the previous merge's pingdotgg#4727). Verified: pnpm typecheck clean across all 15 packages; web (1666), server (1771), client-runtime (497) tests pass; lint clean.
…nd; green tip Bring Tim layer tip to typecheck green by joining main ref-refresh VCS client state with fork failureKind/worktree-cleanup contracts, restoring filterBrowseEntries/reuse-base-branch surfaces Tim dropped, and fixing ChatView/Board call-site type errors left by incomplete Tim joins. (cherry picked from commit 0e24917)

What changed
for-each-refcallRoot cause
Each retained
vcs.listRefsatom polled independently. On this repository that multiplied 31 concurrent requests into repeated full scans across 838 worktrees and roughly 16,700 refs. The server had no shared snapshot, single-flight guard, or concurrency bound, so identical requests launched many expensivegit branch,git worktree list, and ref-enumeration processes at once.Impact
Ref lists remain fresh on connection changes and explicit refreshes, while background idle work no longer creates a Git subprocess storm. Mutations still invalidate snapshots immediately.
Verification
Co-authored-by: codex codex@users.noreply.github.com
Note
Fix Git ref refresh resource storms with coalesced snapshots, exponential backoff, and invalidation hooks
listRefssnapshot inGitVcsDriverCoreso concurrent paginated calls share one underlyingfor-each-refscan, with generation tracking to prevent stale cache reuse.onSettledhooks on RPC commands.removeVcsRefsandclearVcsRefstoEnvironmentCacheStore(web IndexedDB, mobile SQLite) and a per-environment persistence lock to serialize cache mutations.BranchToolbarBranchSelectorto only trigger next-page loads on downward scroll past a threshold, not on layout or array length changes.list-refsatoms now expire after 30s instead of 5 minutes, causing more frequent re-fetches when the atom is re-subscribed after a period of inactivity.Macroscope summarized 2c4c29c.
Note
Medium Risk
Large changes to GitVcsDriverCore caching, invalidation, and client ref streams affect branch lists and worktree-heavy repos; behavior is heavily tested but touches core VCS paths.
Overview
Stops Git ref refresh from spawning subprocess storms by replacing per-atom 5s polling with one refresh per connection generation (exponential retry, 30s idle atom TTL) and a server-side coalesced snapshot keyed by common Git dir (
for-each-ref+ worktree metadata instead of separate branch listings).Invalidation: VCS mutations (pull, worktree, create/switch ref, publish, stacked actions) clear persisted
vcs-refsvia newclearVcsRefs/removeVcsRefson web and mobile stores, bump a per-environment revision, and invalidate server snapshots after Git-changing RPCs;listRefsaccepts optionalrefresh: true(e.g. PR local branch lookup).UI: Branch picker pagination loads the next page only on downward scroll near the bottom, with a dedicated
isFetchingNextPageflag so background refreshes are not shown as “loading more.”Reviewed by Cursor Bugbot for commit 2c4c29c. Bugbot is set up for automated code reviews on this repo. Configure here.